/**基础表格模型 */
export class BaseModule {
  constructor() {
    this.view = {
      pageNo: 1,
      pageSize: 10,
      total: 0,
      data: [],
    };
  }
  async load(params = {}) {
    try {
      const { data } = this.api(params);
      this.view.total = data.total;
      this.view.data = data.data;
    } catch (e) {
      //TODO handle the exception
      throw new Error("模型 加载数据出错");
    }
  }
}

/**本地表格crud模型 */
export class CRUDTable {
  constructor() {
    this.view = {
      pageNo: 1,
      pageSize: 10,
      total: 0,
      data: [],
    };
  }
  async load(params = {}) {
    try {
      const { data } = this.api(params);
      this.view.total = data.total;
      this.view.data = data.data;
    } catch (e) {
      //TODO handle the exception
      throw new Error("模型 加载数据出错");
    }
  }
}
